import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

const routes: Array<RouteRecordRaw> = [
    {
        path: "/",
        redirect: "/main/home",
    },
    {
        path: "/main",
        name: "main",
        component: () => import("@/views/main/main.vue"),
        children: [
            {
                path: "home",
                name: "home",
                component: () => import("@/views/home/home.vue"),
                redirect: "/main/home/curation",
                children: [
                    {
                        path: "curation",
                        name: "curation",
                        component: () => import("@/views/home/children/curation.vue"),
                    },
                    {
                        path: "westies",
                        name: "westies",
                        component: () => import("@/views/home/children/westies.vue"),
                    },
                    {
                        path: "pants",
                        name: "pants",
                        component: () => import("@/views/home/children/pants.vue"),
                    },
                    {
                        path: "newshoes",
                        name: "newshoes",
                        component: () => import("@/views/home/children/newShoes.vue"),
                    },
                    {
                        path: "fashion",
                        name: "fashion",
                        component: () => import("@/views/home/children/fashion.vue"),
                    },
                    {
                        path: "tideplay",
                        name: "tideplay",
                        component: () => import("@/views/home/children/tidePlay.vue"),
                    },
                ],
            },
            {
                path: "lists",
                name: "lists",
                component: () => import("@/views/lists/lists.vue"),
            },
            {
                path: "my",
                name: "my",
                meta: { isRouterAuth: true },
                component: () => import("@/views/my/my.vue"),
            },
        ],
    },
    {
        path: "/cart",
        name: "cart",
        component: () => import("@/views/cart/shoppingcart.vue"),
    },
    {
        path: "/search",
        name: "search",
        component: () => import("@/views/search/search.vue"),
    },
    {
        path: "/searchlist",
        name: "searchlist",
        component: () => import("@/views/search/searchlist.vue"),
    },
    {
        path: "/detail",
        name: "detail",
        component: () => import("@/views/detail/detail.vue"),
    },
    {
        path: "/person",
        name: "person",
        component: () => import("@/views/my/person.vue"),
    },
    {
        path: "/login",
        name: "login",
        component: () => import("@/views/login/login.vue"),
    },
    {
        path: "/register",
        name: "register",
        component: () => import("@/views/resgister/register.vue"),
    },
    {
        path: "/order",
        name: "order",
        component: () => import("@/views/order/order.vue"),
    },
    {
        path: "/myorder",
        name: "myorder",
        component: () => import("@/views/order/MyOrder.vue"),
    },
    {
        path: "/address",
        name: "address",
        component: () => import("@/views/my/address.vue"),
    },
    {
        path: "/editaddr",
        name: "editaddr",
        component: () => import("@/views/my/editAddress.vue"),
    },
    {
        path: "/avatar",
        name: "avatar",
        component: () => import("@/views/my/avatar.vue"),
    },
    {
        path: "/mylists",
        name: "mylists",
        component: () => import("@/views/lists/mylists.vue"),
    },
    {
        path: "/mylook",
        name: "mylook",
        component: () => import("@/views/my/mylook.vue"),
    },
    {
        path: "/mylike",
        name: "mylike",
        component: () => import("@/views/my/mylike.vue"),
    },
    {
        path: "/modname",
        name: "modname",
        component: () => import("@/views/my/modname.vue"),
    },
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;
